/*
 * @Author: SeonHu
 * @Date: 2025-09-16 14:44:19
 * @LastEditors: SeonHu
 * @LastEditTime: 2025-10-14 11:05:08
 * @FilePath: \bg-vben\src\router\types.ts
 * @Description:
 * Copyright © 2020-2025 SANQING Corporation, All rights reserved.
 */
import type { RouteMeta, RouteRecordRaw } from 'vue-router';

import { defineComponent } from 'vue';

import { RoleEnum } from '@/enums/roleEnum';

export type Component<T = any> =
  | (() => Promise<T>)
  | (() => Promise<typeof import('*.vue')>)
  | ReturnType<typeof defineComponent>;

export interface AppRouteRecordRaw extends Omit<RouteRecordRaw, 'children' | 'meta'> {
  name: string;
  meta: RouteMeta;
  component?: Component | string;
  components?: Component;
  children?: AppRouteRecordRaw[];
  props?: Recordable;
  fullPath?: string;
}

export interface MenuTag {
  type?: 'error' | 'primary' | 'success' | 'warn';
  content?: string;
  dot?: boolean;
}

export interface Menu {
  name: string;

  icon?: string;

  img?: string;

  path: string;

  // path contains param, auto assignment.
  paramPath?: string;

  disabled?: boolean;

  children?: Menu[];

  orderNo?: number;

  roles?: RoleEnum[];

  meta?: Partial<RouteMeta>;

  tag?: MenuTag;

  hideMenu?: boolean;
}

export type MenuModule = Menu;

// export type AppRouteModule = RouteModule | AppRouteRecordRaw;
export type AppRouteModule = AppRouteRecordRaw;
